package com.fhz.a2102shopjava.ui.goods;

import androidx.lifecycle.LiveData;

import com.fhz.a2102shopjava.callback.ApiResponse;
import com.fhz.a2102shopjava.entity.Orders;
import com.fhz.a2102shopjava.entity.ShoppingCart;

import java.util.List;

import javax.inject.Inject;

import retrofit2.http.Query;

/**
 * 时间:2023/8/16
 *
 * @author Mr.Feng
 * 简述: 详情仓库
 */

public class GoodsRepository {
    @Inject
    GoodsLocalDataSource mGoodsLocalDataSource;
    @Inject
    GoodsRemoteDataSource mGoodsRemoteDataSource;

    @Inject
    public GoodsRepository(GoodsLocalDataSource goodsLocalDataSource, GoodsRemoteDataSource goodsRemoteDataSource) {
        mGoodsLocalDataSource = goodsLocalDataSource;
        mGoodsRemoteDataSource = goodsRemoteDataSource;
    }

    public LiveData<ApiResponse<List<ShoppingCart>>> getAllByUserId(int userId){
        return mGoodsRemoteDataSource.getAllByUserId(userId);
    }

    public LiveData<ApiResponse<ShoppingCart >> updateNum( int cartId,  int num){
        return mGoodsRemoteDataSource.updateNum(cartId, num);
    }

}
